home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-04-13 | 1.9 KB | 78 lines | [TEXT/ttxt] |
- -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C)
- -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
- --
- expanded class POINTER
- --
- -- References to objects meant to be exchanged with non-Eiffel
- -- software.
- --
- -- Note : corresponding C type is mapped as "void *" except for
- -- source files "string.e", "array.e" and "fixed_array.e".
- -- In file "string.e", type POINTER is simply mapped as
- -- the usual C type "char*".
- -- In files "array.e" and "fixed_array.e", the mapping depends
- -- on the actual generic type. When the actual generic type
- -- is a reference type, POINTER is mapped as C type "T0 **".
- -- When the actual type is an expanded type, POINTER is mapped
- -- as "<Ti>*" where <Ti> is the corresponding type of expanded
- -- actual generic argument.
- --
-
- inherit
- POINTER_REF
- redefine fill_tagged_out_memory
- end;
-
- feature
-
- is_not_void: BOOLEAN is
- -- Is the external POINTER a non Void pointer ?
- --
- -- NOTE: as POINTER is an expanded class, the Eiffel
- -- test Current /= Void is always true.
- --
- external "CSE"
- end;
-
- is_void: BOOLEAN is
- do
- Result := not is_not_void;
- end;
-
- feature -- Object Printing :
-
- append_in(str: STRING) is
- -- Append on `str' a viewable version of Current
- -- (like the one of C printf "%p").
- local
- p: POINTER;
- do
- from
- tmp_string.blank(127);
- p := tmp_string.to_external;
- c_inline_c("sprintf(_p,%"%%p%",C);");
- variant
- tmp_string.count
- until
- tmp_string.last = '%U'
- loop
- tmp_string.remove_last(1);
- end;
- tmp_string.remove_last(1);
- str.append(tmp_string);
- end;
-
- fill_tagged_out_memory is
- do
- Current.append_in(tagged_out_memory);
- end;
-
- feature {NONE}
-
- tmp_string: STRING is
- once
- !!Result.make(128);
- end;
-
- end -- POINTER
-